package net.wangds.auth.user.entity;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.NoArgsConstructor;
import net.wangds.data.DisableEnum;
import net.wangds.data.Disableable;
import net.wangds.data.impl.IdCreate;

import javax.persistence.*;

/**
 * 用户角色关系.
 */
@Entity
@Table(
        name="auth_user_role_ref",
        uniqueConstraints=@UniqueConstraint(columnNames={"userId","roleId"})
)
@NoArgsConstructor(force = true)
@AllArgsConstructor
@Builder
public class GeneralUserRoleRef extends IdCreate implements Disableable {
    private static final long serialVersionUID = 0;
    /**
     * 用户id.
     */
    @Column(length=36)
    private String userId;


    /**
     * 角色id.
     */
    @Column(length=36)
    private String roleId;

    /**
     * 是否禁用.
     */
    @Enumerated(EnumType.ORDINAL)
    @Column(length=4)
    private DisableEnum disable;

    public String getUserId() {
        return userId;
    }

    public void setUserId(String userId) {
        this.userId = userId;
    }

    public String getRoleId() {
        return roleId;
    }

    public void setRoleId(String roleId) {
        this.roleId = roleId;
    }

    @Override
    public DisableEnum getDisable() {
        return disable;
    }

    @Override
    public void setDisable(DisableEnum disable) {
        this.disable = disable;
    }
}
